package com.yyfax.pay.third.model.to.fuiou.xml;

import java.io.StringWriter;

import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;

import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import com.thoughtworks.xstream.XStream;
import com.thoughtworks.xstream.annotations.XStreamAlias;
import com.thoughtworks.xstream.io.xml.QNameMap;
import com.thoughtworks.xstream.io.xml.StaxDriver;
import com.thoughtworks.xstream.io.xml.StaxWriter;
import com.yyfax.pay.common.util.XmlUtil;


/**
 * 代付接口
 * @author maojian
 *
 */
public class PayOutReqData {

	/**
	 * 版本号
	 */
	@XStreamAlias("ver")
	private String ver;

	/**
	 * 请求日期
	 */
	@XStreamAlias("merdt")
	private String merDate;

	/**
	 * 请求流水
	 */
	@XStreamAlias("orderno")
	private String orderNo;

	/**
	 * 总行代码
	 */
	@XStreamAlias("bankno")
	private String bankNo;

	/**
	 * 城市代码
	 */
	@XStreamAlias("cityno")
	private String cityNo;

	/**
	 * 支行名称
	 */
	@XStreamAlias("branchnm")
	private String branchName;

	/**
	 * 账号
	 */
	@XStreamAlias("accntno")
	private String accntNo;

	/**
	 * 账户名称
	 */
	@XStreamAlias("accntnm")
	private String accntName;

	/**
	 * 金额
	 */
	private String amt;

	/**
	 * 企业流水号
	 */
	@XStreamAlias("entseq")
	private String entSeq;

	/**
	 * 备注
	 */
	private String memo;

	/**
	 * 手机号
	 */
	private String mobile;

	public PayOutReqData(){
		super();
	}

	public String getVer() {
		return ver;
	}

	public void setVer(String ver) {
		this.ver = ver;
	}

	public String getMerDate() {
		return merDate;
	}

	public void setMerDate(String merDate) {
		this.merDate = merDate;
	}

	public String getOrderNo() {
		return orderNo;
	}

	public void setOrderNo(String orderNo) {
		this.orderNo = orderNo;
	}

	public String getBankNo() {
		return bankNo;
	}

	public void setBankNo(String bankNo) {
		this.bankNo = bankNo;
	}

	public String getCityNo() {
		return cityNo;
	}

	public void setCityNo(String cityNo) {
		this.cityNo = cityNo;
	}

	public String getBranchName() {
		return branchName;
	}

	public void setBranchName(String branchName) {
		this.branchName = branchName;
	}

	public String getAccntNo() {
		return accntNo;
	}

	public void setAccntNo(String accntNo) {
		this.accntNo = accntNo;
	}

	public String getAccntName() {
		return accntName;
	}

	public void setAccntName(String accntName) {
		this.accntName = accntName;
	}

	public String getAmt() {
		return amt;
	}

	public void setAmt(String amt) {
		this.amt = amt;
	}

	public String getEntSeq() {
		return entSeq;
	}

	public void setEntSeq(String entSeq) {
		this.entSeq = entSeq;
	}

	public String getMemo() {
		return memo;
	}

	public void setMemo(String memo) {
		this.memo = memo;
	}

	public String getMobile() {
		return mobile;
	}

	public void setMobile(String mobile) {
		this.mobile = mobile;
	}

	/**
	 * 该实体转换成XML字符串
	 * 
	 * @author maojian
	 * @date 2017-4-12 10:52:52
	 * @since v1.0.0
	 * @return 返回XML字符串
	 */
	public String toXml() {
		QNameMap qmap = new QNameMap();
		qmap.setDefaultPrefix("");
		StaxDriver staxDriver = new StaxDriver(qmap);
		XStream xstream = new XStream(staxDriver);
		xstream.autodetectAnnotations(true);
		xstream.ignoreUnknownElements();
		xstream.alias("payforreq", PayOutReqData.class);
		try {
			StringWriter strWriter = new StringWriter();
			// don't do startDocument and do repair namespaces
			StaxWriter sw = new StaxWriter(staxDriver.getQnameMap(), staxDriver.getOutputFactory().createXMLStreamWriter(strWriter), false, true);
			xstream.marshal(this, sw);
			sw.close();
			return "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" + strWriter.toString();
		} catch (Exception e) {
			e.printStackTrace();
		}
		return null;
	}
	
	@Override
	public String toString() {
        return ToStringBuilder.reflectionToString(this, ToStringStyle.SHORT_PREFIX_STYLE);
	}
	
}
